package com.shangcheng.model.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageResult implements Serializable {

    private Integer total = 0;//总记录数
    private Integer pageSize;//页大小
    private Integer totalPage = 0;//总页数,对应pages
    private Integer pageNum;//当前页码
    private List<?> list = Collections.emptyList(); //列表

   public PageResult(Integer pageNum,Integer pageSize,int total,List list) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.list = list;
        this.total = total;
        this.totalPage = total % pageSize == 0 ? total / pageSize : total / pageSize + 1;
    }
}